#define _GNU_SOURCE
#include <vector3.h>
#include <stdio.h>
#include <stdlib.h>

vector3_t *
vector3_new( void )
{
  return calloc( 1, sizeof(vector3_t) );
}

void
vector3_free( vector3_t *v )
{
  assert( v != NULL );
  free( v );
}

char *
vector3_str( const vector3_t v )
{
  char *s = NULL;
  asprintf( &s,
	    "[ %0.3lf, %0.3lf, %0.3lf ]",
	    v.data[ 0 ], v.data[ 1 ], v.data[ 2 ] );
  return s;
}
